package com.avp;

import java.net.*;

public class User implements Comparable<User>{
	private String _userName;
	private SocketAddress _ip;
	private int pingTicks;
	public User(String username, SocketAddress ip) {
		_userName = username;
		_ip = ip;
		pingTicks = 0;
	}
	public void setUserName(String s) {
		_userName = s;
	}
	public String getUserName() {
		return _userName;
	}
	public SocketAddress getIP() {
		return _ip;
	}
	public int compareTo(User u) {
		int nameCompare = _userName.compareTo(u.getUserName());
		return nameCompare;
	}
	public synchronized void resetPingTicks() {
		pingTicks = 0;
	}
	public synchronized void incrementPing() {
		pingTicks++;
	}
	public int getPing() {
		return pingTicks;
	}
	public static User NULLUSER = new User(null, null);
}
